package com.handong.handdemo.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.handong.handdemo.R;
import com.handong.handdemo.entitiss.FootRingDemo;
import com.handong.handdemo.entitiss.FootRingNewEntity;
import com.handong.handdemo.entitiss.FootRingStatus;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class RingListAdapter extends BaseQuickAdapter<FootRingNewEntity,BaseViewHolder> {

      public RingListAdapter(int layoutResId, @Nullable List<FootRingNewEntity> data) {
        super(layoutResId, data);
    }

    private static final int LOCK_TYPE_CLOSED = 0;
    private static final int LOCK_TYPE_OPEN = 1;
    private static final int LOCK_EMPOWER_OPEN = 2;
    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, FootRingNewEntity footRingNewEntity) {
//          String ss=footRingNewEntity.isMyBinding()?"自检成功":"自检失败";
        int status = footRingNewEntity.getLockType();
        String ss="";
        if (status == LOCK_TYPE_CLOSED) {
            ss="关";
        } else if (status == LOCK_TYPE_OPEN)
        {
            ss="开";
        }else {
            ss="啥情况";
        }

        baseViewHolder.setText(R.id.ringItemID, footRingNewEntity.getRingID())
                  .setText(R.id.ringDistance,footRingNewEntity.getActualRingDistance()+"m")
                .setText(R.id.ringLockType, ss)
                .setText(R.id.ringElectricType,"电量："+footRingNewEntity.getRingPower()+"%")
                .setText(R.id.ringBrokenType,"版本："+footRingNewEntity.getVersion())
//                .setText(R.id.sendOrder,ss)
        ;
    }
}
